package common.service;

import util.DebugUtil;
import common.proxy.ServiceProxy;
import common.web.WebHelper;

public class ServiceFactory {
	public static IService getService(IService service) {
		if(service == null) service = new BaseService();
		DebugUtil.print("生成代理类：" + service.getClass().getName());
		ServiceProxy serviceProxy = new ServiceProxy(service);
		return (IService) serviceProxy.getProxyObj();
	}
	
	public static IService getService(IService service, WebHelper webHelper) {
		if(service == null) service = new BaseService();
		ServiceProxy serviceProxy = new ServiceProxy(service);
		IService proxyObj = (IService) serviceProxy.getProxyObj();
		proxyObj.setWebHelper(webHelper);
		return proxyObj;
	}
}
